package com.katesoft.scale4j.persistent.exceptions;

/**
 * this exception created to help handing database java enum mapping inconsistency.
 *
 * @author katesoft 2007
 */
public class UnknownEnumValueException extends RuntimeException
{
    private Class<?> enumClass;
    private String dbValue;

    public UnknownEnumValueException(final Class<?> enumClass,
                                     final String dbValue)
    {
        assert enumClass != null;
        this.enumClass = enumClass;
        this.dbValue = dbValue;
    }

    @Override
    public String getMessage()
    {
        return String.format("Unable to identify correct enum of class[%s] for db value[%s]", enumClass, dbValue);
    }
}
